
const _collider = Symbol('_collider');
const _overlap = Symbol('_overlap');
const _error = Symbol('_error');
export default class UtilsDetection {
    constructor(_options, _callback, _that) {
        if (!_options) return this[_error]('no options?');
        this.options = _options;
        this.callback = _callback;
        this.options.type === '_collider' ? this[_collider](_that) : this[_overlap](_that);
    }

    [_collider](_that) {
        _that.physics.add.collider(_that[this.options.key], _that[this.options.targetKey], (e,v) => {
            this.callback(v);
        });
    }

    [_overlap](_that) {
        _that.physics.add.overlap(_that[this.options.key], _that[this.options.targetKey], (e,v) => {
            this.callback(v);
        });
    }

    [_error](err) {
        throw err;
    }
}